<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>自定义网页管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function() {
			
			var ptype = '${customPage.type}';
			ptype = (ptype==null || ptype=='') ?'1':ptype;
			$("#pageType").val(ptype);
			
			$("#name").focus();
			$("#inputForm").validate({
				submitHandler: function(form){
					loading('正在提交，请稍等...');
					form.submit();
				},
				errorContainer: "#messageBox",
				errorPlacement: function(error, element) {
					$("#messageBox").text("输入有误，请先更正。");
					if (element.is(":checkbox")||element.is(":radio")){
						error.appendTo(element.parent().parent());
					} else {
						error.insertAfter(element);
					}
				}
			});
		});
	</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<li><a href="${ctx}/momarketing/customPage/">自定义网页列表</a></li>
		<li class="active"><a href="${ctx}/momarketing/customPage/form?id=${customPage.id}">自定义网页<shiro:hasPermission name="momarketing:customPage:edit">${not empty customPage.id?'修改':'添加'}</shiro:hasPermission><shiro:lacksPermission name="momarketing:customPage:edit">查看</shiro:lacksPermission></a></li>
	</ul><br/>
	<form:form id="inputForm" modelAttribute="customPage" action="${ctx}/momarketing/customPage/save" method="post" class="form-horizontal"  enctype="multipart/form-data">
		<form:hidden path="id"/>
		<form:hidden path="user.id"/>
		<tags:message content="${message}"/>
		<div class="control-group">
			<label class="control-label">标题:</label>
			<div class="controls">
				<form:input path="name" htmlEscape="false" maxlength="11" class="required"/>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">重复次数:</label>
			<div class="controls">
				<form:input path="repeatCount" htmlEscape="false" maxlength="11" class="required number"/>
			</div>
		</div>
		
		<div class="control-group">
			<label class="control-label">按钮名称:</label>
			<div class="controls">
				<form:input path="buttonName" htmlEscape="false" maxlength="30" class="required"/>
			</div>
		</div>
		
		
		<div class="control-group">
			<label class="control-label">网页类型:</label>
			<div class="controls" >
				<select name="type" id="pageType">
					<option value="1">普通网页</option>
					<option value="2">签到网页</option>
					<option value="3">广告网页</option>
				</select>
			</div>
		</div>
		
		<div class="control-group">
			<label class="control-label">所得积分:</label>
			<div class="controls">
				<input name="pScore" class="required number" type="text" htmlEscape="false" value="<fmt:formatNumber value='${customPage.score/1000}' pattern='###.###'  minFractionDigits='3'/>">
				<!-- 
				<form:input path="score" htmlEscape="false" class="required number"/>
				 -->
				<label style="color:grey"><span class="alert">（元）精确到小数点后三位</span></label>
			</div>
		</div>
		
		
		<div class="control-group">
			<label class="control-label">要求时长:</label>
			<div class="controls">
				<form:input path="adTimeout" htmlEscape="false" maxlength="11" class="required number"/><span class="alert">秒</span>
			</div>
		</div>
		
		
		<div class="control-group">
			<label class="control-label">封页:</label>
			<div class="controls">
				<c:if test="${customPage.picname ne '' }">
					<div class="control"><img src="${ctxUser }/pages/${customPage.picname }"   style="width:300px;height:100px"  /><span class="alert" style="margin-left:50px;">大图片建议尺寸：360像素 * 200像素 </span> </div>
				</c:if>
				<div class="control">
					<input type="file" name="picfile" htmlEscape="false"   />         
				</div>
			</div>
		</div>
		
		
		
		
		<div class="control-group">
			<label class="control-label">内容:</label>
			<div class="controls">
				<form:textarea id="content" htmlEscape="true"  path="content" rows="4"  class="input-xlarge required"/>
				<tags:ckeditor replace="content" uploadPath="/project/pics" />
			</div>
		</div>
		
		
		
		
		<div class="form-actions">
			<shiro:hasPermission name="momarketing:customPage:edit"><input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存"/>&nbsp;</shiro:hasPermission>
			<input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
		</div>
	</form:form>
</body>
</html>
